import request from '@/router/axios'
import store from '@/store'
import {fenExYuangettoFixed, getMappingStatus, numToTwoPoint} from "../../commonCheck";
export const tableOptionOne = {//线下正常售卖(售票员)
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  menuWidth:150,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  align: 'center',
  menu:false,
  selection: false,
  reserveSelection:false,
  addBtn: false,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    hide: false,
    label: '车票名称',
    prop: 'ticketName',
    search: false,
  }, {
    hide: false,
    label: '票价',
    prop: 'ticketPrice',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    }
  },{
    label: '现金售卖张数',
    prop: 'cashSellNum',
    hide: false
  },{
    label: '现金售卖金额',
    prop: 'cashSellAmount',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    },
    hide: false,
  }, 
  // {
  //   label: '支付宝售卖张数',
  //   prop: 'alipaySellNum',
  //   hide: false,
  // }, {
  //   hide: false,
  //   label: '支付宝售卖金额',
  //   formatter:function(row, value , label, column){
  //     return numToTwoPoint(value);
  //   },
  //   prop: 'alipaySellAmount'
  // }, {
  //   label: '微信售卖张数',
  //   prop: 'wechatSellNum',
  //   hide: false,
  // }, {
  //   hide: false,
  //   label: '微信售卖金额',
  //   formatter:function(row, value , label, column){
  //     return numToTwoPoint(value);
  //   },
  //   prop: 'wechatSellAmount'
  // }, 
  {
    label: '合计张数',
    prop: 'totalSellNum',
    hide: false,
  }, {
    hide: false,
    label: '合计金额',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    },
    prop: 'totalSellAmount'
  }, {
    label: '日期',
    prop: 'sellTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type: 'date',
    hide: false,
  },
  //  {
  //   hide: false,
  //   label: '售票员',
  //   prop: 'conductorName'
  // }, {
  //   label: '售票员工号',
  //   prop: 'conductorJobNo',
  //   hide: false,
  // }
  ]
}

export const tableOptionTwo = {//取票
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  menuWidth:150,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  align: 'center',
  menu:false,
  selection: false,
  reserveSelection:false,
  addBtn: false,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    hide: false,
    label: '车票名称',
    prop: 'ticketName',
    search: false,
  }, {
    hide: false,
    label: '票价',
    prop: 'ticketPrice',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    }
  },{
    label: '张数',
    prop: 'ticketNum',
    hide: false
  },{
    label: '售卖金额',
    prop: 'sellAmount',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    },
    hide: false,
  }, {
    label: '取票方式',
    prop: 'takeTicketWay',
    hide: false,
    formatter:function (row,v) {
      return getMappingStatus('take_ticket_type',v);
    }
  }, {
    hide: false,
    label: '回执单号',
    prop: 'ticketWayNum'
  },{
    label: '日期',
    prop: 'takeTicketTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type: 'date',
    hide: false,
  }, {
    hide: false,
    label: '上传回执单',
    prop: 'receiptFilePath',
    slot:true,
    formslot:true
  }]
}

export const tableOptionThree = {//取票
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  menuWidth:150,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  align: 'center',
  menu:false,
  selection: false,
  reserveSelection:false,
  addBtn: false,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    hide: false,
    label: '车票名称',
    prop: 'ticketName',
    search: false,
  }, {
    hide: false,
    label: '票价',
    prop: 'ticketPrice',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    }
  },{
    label: '支付方式',
    prop: 'payMethod',
    hide: false,
    formatter:function (row,v) {
      return getMappingStatus('pay_type',v);
    }
  },{
    label: '售卖张数（张）',
    prop: 'sellNum',
    hide: false,
  }, {
    label: '售卖金额',
    prop: 'sellAmount',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    },
    hide: false,
  }, {
    hide: false,
    label: '折扣率（%）',
    prop: 'discountRate',
    formatter:function(row, value , label, column){
      if(/[\d+\.-]/g.test(value)){
        return value+'%';
      }
      return '';
    }
  },
    {
      hide: false,
      label: '折扣后金额',
      prop: 'discountAmount',
      formatter:function(row, value , label, column){
        return numToTwoPoint(value);
      }
    },{
    label: '回执单号',
    prop: 'ticketWayNum',
    hide: false,
  }, {
    hide: false,
    label: '日期',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
      width: 90,
    type: 'date',
    prop: 'sellTime'
  }, {
    hide: false,
    label: '上传回执单',
    prop: 'receiptFilePath',
    slot:true,
    formslot:true
  }]
}
export function getSwStMarketingTicketGroupSell(param) {
  return request({
    url: '/check/check/getSwStMarketingTicketGroupSell',
    method: 'post',
    params: param
  })
}
export function getSwStMarketingTicketOffineSell(param) {
  return request({
    url: '/check/check/getSwStMarketingTicketOffineSell',
    method: 'post',
    params: param
  })
}
export function getSwStMarketingTicketOffineTakeTicket(param) {
  return request({
    url: '/check/check/getSwStMarketingTicketOffineTakeTicket',
    method: 'post',
    params: param
  })
}
export function getSysUserToLine(param) {
  return request({
    url: '/check/check/getSysUserToLine',
    method: 'post',
    params: param
  })
}

